<template>
  <div id="welfareList"> 


        <el-table :data="datalist" style="width: 100%" :height="dtheight" :header-cell-style="{background:'#4F81BC',color:'white'}"
           :row-class-name="tableRowClassName"  :border="true">
                
                 <el-table-column label="领取时间"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span >{{ getymdhms(scope.row.time * 1000) }}</span>
                    </template>
                </el-table-column>
                 <el-table-column label="账号"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.telphone }}</span>
                    </template>
                </el-table-column>
                 <el-table-column label="用户名"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.nickname }}</span>
                    </template>
                </el-table-column>
                 <el-table-column label="地址信息"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span>
                            <!-- <span >{{ scope.row.address_info[0].username }}</span>
                            -
                            <span >{{ scope.row.address_info[0].telphone }}</span>
                            -
                            <span >{{ scope.row.address_info[0].region }}</span>
                            <span >{{ scope.row.address_info[0].detail }}</span> -->
                            {{ scope.row.ads }}
                        </span>
                    </template>
                </el-table-column>
                

                 <el-table-column label="操作" align='center' width="150" fixed="right">
                    <template slot-scope="scope">                           
                        <el-button  size="mini"  type="primary"  class="button_class1"  plain v-if="scope.row.status == 0" @click="ff_but(scope.row)">发放福利</el-button>
                        <el-button  size="mini"  type="primary"  class="button_class2"  plain v-if="scope.row.status == 1">已发放</el-button>                            
                    </template>
                </el-table-column>
        </el-table> 







   </div>
</template>

<script>

export default {
   name: 'welfareList',
   props:{
      datalist:{  
        //type:Array,
       default:()=>[]
     },
  },
  data () {
    return {
        dtheight:'500',  //窗口高度
    }
  },
   components:{

  },
  created(){
     this.dtheight = window.innerHeight - 343

  },
  mounted (){
    
  },
  methods: { 
    ff_but(row){
        this.$confirm('是否发放奖励, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
         }).then(() => {
                this.post("/welfare/send", {
                    welfare_id:row.welfare_id,
                }).then(res => {

                    if(res.error_code == 0){
                    this.open1(res.result,'success')  //提示框
                    this.$emit('up_list_fun')
                    }else {
                    this.open1(res.message,'warning')
                }

             })
        }).catch(() => {
                  this.$emit('up_list_fun') 
        });
    },
  }
}
</script>


<style scoped>

</style>